//
//  YAYISchedulingItemModel.m
//  YAYIDoctor
//
//  Created by Veer on 16/6/6.
//
//

#import "YAYISchedulingItemModel.h"

#import "YAYISchededdModel.h"
#import "YAYIScheduledTimeModel.h"



@implementation YAYISchedulingItemModel


- (instancetype)init
{
    if (self = [super init]) {
        self.flagArray = [@[@(0), @(0)] mutableCopy];
    }
    return self;
}


- (void)setSchedulingModel:(YAYISchededdModel *)schedulingModel
{
    _schedulingModel = schedulingModel;
    
    if (schedulingModel) {
        NSArray *timeModelArray = schedulingModel.scheduledTimeModelArray;
        
        for (YAYIScheduledTimeModel *timeModel in timeModelArray) {
            if ([timeModel.iscurrent isEqualToString:@"Y"]) {
                if ([timeModel.type isEqualToString:@"morning"]) {
                    
                    self.flagArray[0] = @(1);
                }else if ([timeModel.type isEqualToString:@"afternoon"]) {
                
                    self.flagArray[1] = @(1);
                }
            }
            
        }
    }else{
        self.flagArray = [@[@(0), @(0)] mutableCopy];
    } 
}

@end
